<!DOCTYPE html>
<html lang="en">
<head>
    <title>创建投票</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=4a6c1b54">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <script type="text/javascript" src="/dist/plugins/vue/vue.js"></script>
    <link href="/dist/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"/>
    <link href="votePublic.css" rel="stylesheet"/>
    <style>
        [v-cloak] {
            display: none;
        }

        input:focus {
            　　font-size: 16px !important;
        }

        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            outline: none;
        }

        body {
            background: rgb(243, 244, 248);
        }

        .btn-blue {
            border: none;
            background: #2a8cec;
            color: #fff;
            height: 30px;
            width: 14%;
            border-radius: 3px;
        }

        .visitingBox {
            background: #fff;

        }

        .item {
            height: 45px;
            line-height: 45px;
            padding: 0 10px;
            font-size: 14px;
            border-bottom: 1px solid #ddd;
            position: relative;
        }

        .item .title {
            text-align: center;
        }

        .item .time {
            color: #333;
            text-align: center;

        }

        .btn-blue.focus, .btn-blue:focus, .btn-blue:hover {
            color: #fff;
            text-decoration: none;
        }

        .lineTwo span {
            max-height: 55px;
            line-height: 16px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
            text-align: left;
            padding: 5px;

        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .imgBox {
            margin-left: 20px;
        }

        .imgBox .title {
            padding-left: 5px;
            height: 45px;
            line-height: 45px;
            position: relative;
            font-size: 14px;
        }

        .imgBox .title i {
            position: absolute;
            left: -10px;
            top: 2px;
            color: red;
            font-size: 16px;
        }

        .imgBox img {
            width: 80px;
            height: 80px;
            margin-bottom: 20px;
        }

        .imgBox .desc {
            color: #aaa;
        }

        .btnBox {
            width: 120px;
            height: 120px;
            margin: 0 auto;
            margin-top: 60px;
            position: relative;
        }

        .btnBj {
            background: #cde2f7;
            border-radius: 50%;
            width: 100%;
            height: 100%;
            position: relative;
            animation: mymove 3s infinite;
            -webkit-animation: mymove 3s infinite; /*Safari and Chrome*/
            animation-direction: alternate; /*轮流反向播放动画。*/
            animation-timing-function: linear; /*动画的速度曲线*/
            /* Safari 和 Chrome */
            -webkit-animation: mymove 3s infinite;
            -webkit-animation-direction: alternate; /*轮流反向播放动画。*/
        }

        @keyframes mymove {
            0% {
                transform: scale(1); /*开始为原始大小*/
            }

            50% {
                transform: scale(0.8);
            }

        }

        @-webkit-keyframes mymove /*Safari and Chrome*/
        {
            0% {
                transform: scale(1); /*开始为原始大小*/
            }

            50% {
                transform: scale(0.8);
            }
        }

        .tijiaoBtn {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 50px;
            line-height: 50px;
            background: #2a8cec;
            color: #fff;
            text-align: center;
            font-weight: bold;
            font-size: 16px;
        }

        .item input {
            border: none;
            width: 100%;
            float: left;
            height: 45px;
            line-height: 45px;
            background: none;
            text-align: center;

        }

        .voteTitle {
            font-size: 20px;
            font-weight: bold;
            color: rgb(42, 140, 236);
        }

        .voteDesc {
            color: rgb(42, 140, 236);
        }

        .addIcon {
            background: #228bee;
            width: 50px;
            height: 30px;
            margin: 0 auto;
            float: left;
            border-radius: 5px;
            background-size: cover;
            /* margin-top: 7px; */
            color: #fff;
            font-style: normal;
            text-align: center;
            line-height: 30px;
            font-size: 14px;
        }

        /*.removeIcon {*/
        /*background: url("/dist/img/jianIcon.png");*/
        /*background-size: cover;*/
        /*width: 20px;*/
        /*height: 20px;*/
        /*position: absolute;*/
        /*margin-right: 5px;*/
        /*margin-top: 12px;*/
        /*}*/
        .removeIcon {
            background-color: rgb(230, 67, 64);
            width: 50px;
            height: 30px;
            border-radius: 5px;
            background-size: cover;
            margin: 0 auto;
            float: left;

            color: #fff;
            font-style: normal;
            text-align: center;
            line-height: 30px;
            font-size: 14px;
        }

        .timeBox {
            height: 90px;
            line-height: 45px;
            font-size: 14px;
            border-bottom: 1px solid #ddd;
            position: relative;
            background: #fff;
            margin: 0;
            margin-top: 10px;
            padding: 0 15px;
        }

        input::-webkit-input-placeholder {
            color: #aaa;
        }

        .dian {
            position: absolute;
            width: 10px;
            height: 10px;
            background: #2a8cec;
            border-radius: 50%;
            top: 18px;
            left: 10px;
        }

        .yz {
            position: absolute;
            right: 60px;
            top: 0px;
            font-size: 12px;
            color: red;
            display: none;
        }

        .disaItem {
            background: rgb(235, 235, 228);
        }

        .scfj {
            background: url(/dist/img/fjT1.png) no-repeat 5px center;
            display: block;
            padding: 0 4px;
            height: 45px;
            line-height: 45px;
            padding-left: 15px;
            margin: 0 auto;
            width: 100px;
            border-radius: 4px;
            float: left;
            color: #74adf2;
            text-align: left;
        }

        .fjBox {
            width: 100%;
            float: left;
            height: 100%;
            background-color: #E3EAF4;
        }

        .fj-tanzhongStyle {
            margin-top: 3px;
            height: 40px;
        }

        .fj-tanzhongStyle .img {
            transform: scale(1, 1);
            margin: 4px 0 0 4px;
        }

        .fj-tanzhongStyle .name {
            line-height: 16px;
            text-align: left;
            height: 16px;
            font-size: 14px;
            top: 11px;
            width: 100%;
            padding-right: 50px;

        }

        .fj-tanzhongStyle .del {
            top: 15px;
            /* bottom: 0; */
            line-height: 30px;
            left: 42px;
        }

        .table > thead > tr > th {
            background: rgb(248, 248, 248);
            height: 30px;
        }

        .fixHeader th {
            height: 45px !important;
        }

        .time_span1 {
            margin-left: 10px;
        }

        .timeBox input {
            border: 0px;
            outline: none;
            cursor: pointer;
            /* width: 45%; */
            /* margin-left: 22px; */
            text-align: center;
            color: rgb(42, 140, 236);
        }

        .time-controller {
            position: fixed;
            left: 0;
            top: 0;
            z-index: 100;
            width: 100%;
            height: 100%;
            overflow: hidden;
            text-align: center;
            font-size: 14px;
            background-color: rgba(37, 38, 45, .4);
        }

        .time-controller .time-controller-all {
            position: absolute;
            z-index: 600;
            bottom: 0;
            width: 100%;
            height: 273px;
            background: #fff;
        }

        .time-controller .time-controller-all .time-controller-choice {
            position: relative;
            height: 60px;
            color: #999;
        }

        .time-controller .time-controller-all .time-controller-content {
            position: relative;
            top: 20px;
            height: 173px;
        }

        .border-bottom,
        .border-top {
            position: relative;
        }

        .border-bottom:after,
        .border-bottom:before,
        .border-top:after,
        .border-top:before {
            content: "";
            display: block;
            position: absolute;
            -webkit-transform-origin: 0 0;
            transform-origin: 0 0;
        }

        .border-bottom:after {
            border-bottom: 1px solid #ebebeb;
            left: 0;
            bottom: 0;
            width: 100%;
            -webkit-transform-origin: 0 bottom;
            transform-origin: 0 bottom;
        }

        .time-controller .time-controller-all .time-controller-choice .cancel {
            left: 0;
        }

        .time-controller .time-controller-all .time-controller-choice .sure {
            right: 0;
            color: #fc9153;
        }

        .time-controller .time-controller-all .time-controller-choice .time-controller-top {
            margin: 0;
            line-height: 60px;
            font-weight: 400;
            text-align: center;
            font-size: 18px;
            color: #333;
        }

        .time-controller .time-controller-all .time-controller-choice .cancel,
        .time-controller .time-controller-all .time-controller-choice .sure {
            position: absolute;
            top: 6px;
            padding: 16px;
            font-size: 14px;
        }

        .time-controller .time-controller-all .time-controller-content .time-package-top {
            position: absolute;
            top: 0;
            background: -webkit-linear-gradient(bottom, hsla(0, 0%, 100%, .4), hsla(0, 0%, 100%, .8));
            background: linear-gradient(bottom, hsla(0, 0%, 100%, .4), hsla(0, 0%, 100%, .8));
        }

        .time-controller .time-controller-all .time-controller-content .time-package-bottom {
            position: absolute;
            bottom: 1px;
            background: -webkit-linear-gradient(top, hsla(0, 0%, 100%, .4), hsla(0, 0%, 100%, .8));
            background: linear-gradient(top, hsla(0, 0%, 100%, .4), hsla(0, 0%, 100%, .8));
        }

        .time-controller .time-controller-all .time-controller-content .time-package-bottom,
        .time-controller .time-controller-all .time-controller-content .time-package-top {
            z-index: 10;
            width: 100%;
            height: 68px;
            pointer-events: none;
            -webkit-transform: translateZ(0);
            transform: translateZ(0);
        }

        .border-top:before {
            border-top: 1px solid #ebebeb;
            left: 0;
            top: 0;
            width: 100%;
        }

        .time-controller .time-controller-all .time-package {
            display: -webkit-box;
            display: flex;
            padding: 0 16px;
        }

        .time-controller .time-controller-all .time-package .time {
            flex: 1;
            flex-basis: 1 e-9px;
            width: 1%;
            height: 173px;
            overflow: hidden;
            font-size: 20px;
        }

        .time-controller .time-controller-all .time-package .time:first-child {
            flex: 1.8;
        }

        .time-controller .time-controller-all .time-package .time .time-list {
            padding: 0;
            margin-top: 68px;
            line-height: 36px;
            list-style: none;
            transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
        }

        .time-controller .time-controller-all .time-package .time .diff {
            transition-duration: 150ms;
        }

        .time-controller .time-controller-all .time-package .time .time-list .time-list-item {
            transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
        }

        .table-detail th.td-title {
            background: #2a8cec;
            color: #fff;
            font-size: 16px !important;
            line-height: 30px;
        }

        .table-detail td.td-title {
            font-size: 12px !important;
            line-height: 30px;
            background-color: rgb(245, 245, 245);
            color: #333;
        }

        .table-detail td.td-value {
            color: #fff;
            font-size: 12px !important;
            line-height: 45px;
            background: #fff;
            padding-left: 10px !important;
        }

        .ldName {
            text-align: justify;
            width: 36px;
            display: inline-block;
            line-height: 0px;
        }

        .ldName:after {
            content: " ";
            display: inline-block;
            width: 100%;
        }

        .openVoteStyle {
            position: absolute;
            background: rgb(42, 140, 236);
            color: #fff;
            margin-top: 28px;
            right: 10px;
        }

        .shTable {
            margin-bottom: 0;
            border: none;
        }

        .shTable th {
            background-color: #f5f5f5;
            background: #d3e8fd !important;
            color: black !important;
            font-size: 12px !important;
            height: 30px !important;
        }

        .touBtn {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 50px;
            line-height: 50px;
            background: #2a8cec;
            color: #fff;
            text-align: center;
            font-weight: bold;
            font-size: 16px;
            margin: 0 auto;
            z-index: 11111;
        }

        .touBtn div {
            float: left;
            width: 50%;
            box-sizing: border-box;
            font-size: 16px;
        }

        .touBtn .line {
            height: 24px;
            width: 1px;
            background: #fff;
            position: absolute;
            left: 50%;
            top: 13px;
        }

        .table-detail {
            background: #fff;
        }

        .oaColor {
            color: #2a8cec;
        }
    </style>
</head>
<body>
<section class="content" id="app" style="padding: 0px;padding-bottom: 50px;" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <div class="treeBox" v-show="userModel">
        <div class="tabContent">
            <div class="tabContentLeft"></div>
            <div class="tabContentMiddle">
             <span :class="selectTree==0? 'tabActive':'tabNo'" @click="selectTree=0;changeTree()">
                    按组织结构选择
                </span>
                <span id="cusBtn" :class="selectTree==1? 'tabActive':'tabNo'" @click="selectTree=1;">
                    按部门岗位选择
                </span>

            </div>
            <div class="tabContentRight"></div>
        </div>
        <div style="overflow: auto;background: #f7f8fa;margin: 15px 20px;margin-top:60px;border: 1px solid #ddd;">
            <div class="selectBox" v-show="selectTree==1">
                <div class="typeTitle">请选择公司：</div>
                <div class="companyLIst listBox">
                    <div :class="item.select?'item active':'item'" v-for="(item,i) in selectBox.companyList"
                         @click="selectItem(item,'1')">{{item.name}}
                    </div>
                </div>
                <div class="typeTitle">请选择部门：</div>

                <div class="companyLIst listBox">
                    <div :class="item.select?'item active':'item'" v-for="(item,i) in selectBox.departList"
                         @click="selectItem(item,'2')">{{item.departName}}
                    </div>
                    <div class="noData" v-if="selectBox.departList.length==0">请先选择公司</div>
                </div>
                <div class="typeTitle">请选择职位：</div>
                <div class="companyLIst listBox">
                    <div :class="item.select?'item active':'item'" v-for="(item,i) in selectBox.roleList"
                         @click="selectItem(item,'3')">{{item.roleName}}
                    </div>
                    <div class="noData" v-if="selectBox.roleList.length==0">请先选择部门</div>
                </div>
            </div>
            <div v-show="selectTree==0">
                <div class="inputTreeBox">
                    <input type="text" class="selecetInput" placeholder="输入姓名" id="autoUser" v-on:input="get_search()">
                    <input type="button" class="search-button">
                </div>

                <ul class="ztree" id="ulRegion" style="height: 75vh;overflow-y: auto;"></ul>
            </div>
        </div>
        <input type="button" value="确认" id="btnSave" class="btn oaBtn" @click="saveUser"
               style="margin-bottom:10px;">
    </div>
    <div class="visitingBox">
        <div class="item" style="height: 60px;line-height: 60px;">
            <div v-if="(mainId&&mainInfo.auditFlag!='-4'&&mainInfo.auditFlag!='-5')||(mainInfo.auditFlag=='-4'&&mainInfo.auditFlag!='-5'&&mainInfo.createUserId!=userInfo.id)"
                 class='voteTitle moreTitle'
                 style="overflow: hidden;height: 60px;line-height: 60px;text-align: center;color: rgb(42, 140, 236);    text-overflow: ellipsis;-o-text-overflow: ellipsis;white-space: nowrap;">
                {{mainInfo.title}}
            </div>
            <input v-else type="text" style="height: 60px;line-height: 60px;text-align: center;" v-model="info.title"
                   class="voteTitle" placeholder="投票标题" id="titleInput" v-on:input="inputInTitle()">
        </div>
        <table class="table  text-center fixHeader"
               v-if="(mainId&&mainInfo.auditFlag!='-4'&&mainInfo.auditFlag!='-5')||(mainInfo.auditFlag=='-4'&&mainInfo.auditFlag=='-5'&&mainInfo.createUserId!=userInfo.id)">
            <thead>
            <tr>
                <th style="text-align: center;padding-left: 5px;width: 40px;height: 45px;">序号</th>
                <th style="height:45px;">被投票对象</th>
                <th style="height:45px;">参投文件</th>

            </tr>
            </thead>
            <tbody>
            <tr v-for="(item2,i2) in tabList" class="item">
                <td>{{i2+1}}</td>
                <td>{{item2.description}}</td>
                <td style="padding: 0;">
                    <div v-if="item2.attrName" class="fjBox">
                        <div class="fj-tanzhongStyle" v-for="(item3,i3) in item2.attrNameList"  @click="lookFj(item2.attrUrlList[i3])">
                            <b :class="fjStyle(item2.attrNameList[i3])"></b>
                            <div class="name" v-if="item2.attrNameList[i3]" :title="item2.attrNameList[i3]">
                                {{item2.attrNameList[i3]}}
                            </div>
                        </div>
                    </div>
                    <template v-else>
                        <div style="color: red;">未上传</div>
                    </template>
                </td>

            </tr>

            </tbody>
        </table>
        <table class="table  text-center fixHeader" v-else>
            <thead>
            <tr>
                <th style="text-align: center;padding-left: 5px;width: 40px;">序号</th>
                <th>被投票对象</th>
                <!--<th style="text-align: left;padding-left: 18px;">参投文件</th>-->
                <th style="width: 60px;">
                    <i class="addIcon" @click="addAnswer()">新增</i>
                </th>
            </tr>
            </thead>
            <tbody>
            <template v-for="(item,i) in info.voteThemeList">
                <tr v-for="(item2,i2) in item.value" :class="item2.disa?'item disaItem':'item'">
                    <td @click="hideYz(i,i2)">{{i2+1}}</td>
                    <td @click="hideYz(i,i2)"><input type="text" v-model="item2.title" class="voteDesc" :attr-index="i2"
                                                     :idx="i2" :placeholder="'被投票对象'+number2big(i2+1)"
                                                     v-on:input="hideTs($event.target,i,i2)" :id="'input'+i2"
                                                     style="text-align: center;" :disabled="item2.disa"></td>
                    <!--<td @click="hideYz(i,i2)">-->
                    <!--<div v-if="item2.attrName" class="fjBox" @click="lookFj(item2.attrUrl)">-->
                    <!--<div class="fj-tanzhongStyle" >-->
                    <!--<b :class="fjStyle(item2.attrName)"></b>-->
                    <!--<div class="name" v-if="item2.attrName" :title="item2.attrName">-->
                    <!--{{item2.attrName}}-->
                    <!--</div>-->
                    <!--<div class="del" ><a href="javascript:void(0)" class="nui-txt-link"  @click.stop="deleteFile(i,i2)">删除</a></div>-->
                    <!--</div>-->
                    <!--</div>-->
                    <!--<template v-else>-->
                    <!--<div class="scfj" v-if="item2.disa" style="color: rgb(170, 170, 170);">上传附件</div>-->
                    <!--<div class="scfj" v-else  @click="uploadFile(i,i2)">上传附件</div>-->
                    <!--</template>-->
                    <!--</td>-->
                    <td>
                        <i class="removeIcon" @click="removeAnswer(i,i2)">删除</i>
                    </td>
                </tr>
            </template>

            </tbody>
        </table>

    </div>
    <div class="timeBox item">
        <div class="title">参投文件上传截止时间
            <div v-if="mainId&&isOpenBtn&&mainInfo.auditFlag!=-5&&mainInfo.auditFlag==-2&&mainInfo.createUserId==userInfo.id" class="openVoteStyle btn" @click="openVote">开始评比</div>
        </div>
        <div class="time">
            <div v-if="(mainId&&mainInfo.auditFlag!='-4'&&mainInfo.auditFlag!='-5')||(mainInfo.auditFlag=='-4'&&mainInfo.auditFlag!='-5'&&mainInfo.createUserId!=userInfo.id)"
                 class="oaColor">{{mainInfo.uploadTime}}
            </div>

            <input type="text" id="time2" readonly placeholder="请选择时间" v-else/>
        </div>
    </div>
    <div class="timeBox item">
        <div class="title">投票截止时间</div>
        <div class="time">
            <div v-if="(mainId&&mainInfo.auditFlag!='-4'&&mainInfo.auditFlag!='-5')||(mainInfo.auditFlag=='-4'&&mainInfo.auditFlag!='-5'&&mainInfo.createUserId!=userInfo.id)"
                 class="oaColor">{{mainInfo.endTime}}
            </div>
            <input type="text" id="time" readonly placeholder="请选择时间" v-else/>
        </div>
    </div>
    <div class="time-controller">
        <div class="time-controller-all">
            <div class="time-controller-choice border-bottom">
                <span class="cancel">取消</span>
                <span class="sure">确定</span>
                <h1 class="time-controller-top">选择时间</h1>
            </div>
            <div class="time-controller-content">
                <div class="time-package-top border-bottom"></div>
                <div class="time-package-bottom border-top"></div>
                <div class="time-package">
                    <div class="time">
                        <ul class="time-list diff">
                        </ul>
                    </div>
                    <div class="time">
                        <ul class="time-list">
                        </ul>
                    </div>
                    <div class="time">
                        <ul class="time-list">
                        </ul>
                    </div>
                </div>
            </div>
            <div class="time-controller-bottom"></div>
        </div>
    </div>
    <div class="timeBox item">
        <div class="title">选择投票人员 <span v-if="info.voteUsers" style="color: #aaa;font-size: 12px;">(已选择{{info.voteUsers.split(',').length}}人) <b
                @click="lookUser"
                v-if="(!mainId&&info.createUserId==userInfo.id)||(mainInfo.auditFlag=='-4'&&mainInfo.createUserId==userInfo.id)"
                style="font-weight: normal;" class="oaColor">查看</b></span></div>
        <div class="time">
            <div class="userBtn " @click="lookUser" v-if="mainInfo.auditFlag=='-3'" style="color:#2a8cec;text-align: center;">查看</div>
            <div class="userBtn " @click="lookUser"
                 v-else-if="(mainInfo.auditFlag=='-4')&&mainInfo.createUserId!=userInfo.id" style="color:#2a8cec;text-align: center;">查看
            </div>
            <div class="userBtn " @click="showModel"
                 v-else-if="((mainInfo.auditFlag=='-4'||mainInfo.auditFlag=='-5')&&mainInfo.createUserId==userInfo.id)||info.voteUsers"
                 style="color:#2a8cec;text-align: center;">修改
            </div>
            <div class="userBtn " @click="showModel" v-else-if="info.voteUsers" style="color: #aaa;text-align: center;">选择投票人员</div>
            <div class="userBtn " @click="showModel" v-else style="color: #aaa;text-align: center;">选择投票人员</div>
        </div>
    </div>

    <table class="table table-hover text-center  shTable" v-if="createAudit&&createAudit.length>0">
        <thead>
        <tr>
            <th colspan="4">审批进度</th>
        </tr>
        </thead>
    </table>
    <table class="table-detail" style="width: 100%;table-layout: fixed;" v-if="createAudit&&createAudit.length>0">
        <tbody>
        <tr>
            <td class="td-title" style="width: 50px;text-align: center;">审核人</td>
            <td class="td-title" style="width: 60px;text-align: center;">审核状态</td>
            <td class="td-title" style="width: 100px;text-align: center;">审核时间</td>
            <td class="td-title">审核意见</td>
        </tr>
        <tr v-for="(item,i) in createAudit">

            <td style="text-align: center;">
                <span class="ldName oaColor">{{item.auditorName}}</span>
            </td>
            <td style="text-align: center;">
                <span v-if="item.auditFlag===0" style="color:red;">待审核</span>
                <span v-else-if="item.auditFlag===1" class="oaColor">已通过</span>
                <span v-else-if="item.auditFlag===2" class="oaColor">已驳回</span>
                <span v-else-if="item.auditFlag===-1" class="oaColor">未提交</span>
            </td>
            <td style="text-align: center;" class="oaColor">
                {{formatDate(item.auditTime)}}
            </td>
            <td style="text-align: left;">
                <span style="padding-left: 10px;" class="moreSpan oaColor">{{item.auditAdvise}}</span>
            </td>
        </tr>


        </tbody>
    </table>

    <div class="inputBoxBj " v-show="lookUserModel">
        <div class="inputBox moreUserBox">
            <table class="fixed-table_header table-detail " cellspacing="0" cellpadding="0" border="0"
                   style="width: 100%;">
                <thead>
                <tr style="height: 24px;line-height: 24px;">
                    <th style="width:100px;">
                        <div class="table-cells">公司</div>
                    </th>
                    <th>
                        <div class="table-cells">部门</div>
                    </th>
                    <th style="width:100px;">
                        <div class="table-cells">职位</div>
                    </th>
                    <th style="width:60px;">
                        <div class="table-cells">姓名</div>
                    </th>
                </tr>
                </thead>
            </table>
            <div class="desc scrollTable">
                <table class="fixed-table_header table-detail " cellspacing="0" cellpadding="0" border="0"
                       style="width: 100%;">
                    <tbody>
                    <tr v-for="(item,i) in lookUserList">
                        <td style="text-align: center;width:100px;" :rowspan="item.companyNamespan"
                            :class="{hidden: item.companyNamedis}">{{item.companyName}}
                        </td>
                        <td style="text-align: center;" :rowspan="item.departNamespan"
                            :class="{hidden: item.departNamedis}">{{item.departName}}
                        </td>
                        <td style="text-align: center;width:100px;" :rowspan="item.roleNamespan"
                            :class="{hidden: item.roleNamedis}">{{item.roleName}}
                        </td>
                        <td style="text-align: center;width:60px;"><span class="ldName">{{item.name}}</span></td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="okBtn" @click="closeModel">确认</div>

        </div>
    </div>

    <div class="tijiaoBtn" v-if="(mainInfo.auditFlag=='-4')&&mainInfo.createUserId==userInfo.id" @click="updateInfo">
        重新提交
    </div>
    <template v-else-if="mainInfo.auditFlag=='-3'">
        <div class="touBtn" v-if="mainInfo.currentAuditorId==userInfo.id">
            <div class="touTa" @click="audit(1)">通过</div>
            <div class="noTouTa" @click="audit(2)">驳回</div>
            <i class="line"></i>
        </div>
        <div class="tijiaoBtn" v-else style="background: #ddd;color:#fff;">待审核</div>
    </template>
    <!--<div class="tijiaoBtn" style="background: #228bee;" @click="save"-->
         <!--v-else-if="info.createUserId==userInfo.id&&!mainId">提交申请-->
    <!--</div>-->
    <div class="tijiaoBtn" v-else-if="!mainId||mainInfo.auditFlag=='-5'">
        <div class="touBtn" >
            <div class="touTa" @click="save(1)">保存草稿</div>
            <div class="noTouTa" @click="save(2)">提交申请</div>
            <i class="line"></i>
        </div>
    </div>
    <div class="tijiaoBtn" style="background: #228bee;" v-else @click="returnList">完成</div>
</section>

<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="/dist/plugins/scroll/myScroll.js"></script>
<!--框架已定义 JS-->
<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.exhide-3.5.js"></script>

<script>
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo,.moreTitle", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script>
    $.ajaxSetup({
        global: true,
        type: "POST",
        cache: false,
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        beforeSend: function () {
        },
        complete: function () {

        },
        error: function (e) {
            alert('error' + e.responseText);
        }
    });
    $.extend($.wyui, {
        page: {
            urlParams: null,
            queryParams: {
                requestPage: 1,
                pageSize: 30
            },
            dataUrl: '',
            createQueryParams: function () {
            },

            getByPage: function (type) {
                $.ajax({
                    url: $.wyui.page.dataUrl,
                    data: JSON.stringify($.wyui.page.queryParams),
                    beforeSend: function () {

                    },
                    complete: function () {
                    },
                    success: function (r) {
                        $.wyui.page.queryParams.requestPage++;

                        if (r.data.sendData.pager && r.data.sendData.pager.pageCount == 0) {
                            r.data.sendData.pager.pageCount = 1;
                        }
                        if (type == "scroll") {
                            $.wyui.page.getByPage_scroll_callback(r.data.sendData.records);
                        } else {
                            if ($.wyui.page.getByPage_callback_new) {
                                $.wyui.page.getByPage_callback_new(r.data.sendData.records);
                            }
                        }

                    }
                });
            }
        },
        postMethod: function (url, data, callback, sync, id) {
            if (!id) {
                id = "#app"
            }
            $.ajax({
                url: server.ip + url,
                async: sync ? false : true,
                data: JSON.stringify(data),
                beforeSend: function () {

                },
                complete: function () {
                    setTimeout(function () {
                    }, 1000);

                },
                success: function (r) {
                    if (!r.e.code) {
                        callback(r.data.sendData);
                    } else {
                        alert(r.e.desc);
                    }
                },
                error: function (e) {
                    alert(url + e.responseText);
                }
            });
        },
    });
</script>

<script type="text/javascript">

    $(function () {
        var zTreeRegion_setting = {
            view: {
                showIcon: function (treeId, treeNode) {
                    return treeNode.isParent;
                }
            },
            data: {
                simpleData: {
                    enable: true
                }
            },
            check: {
                chkboxType: {"Y": "ps", "N": "ps"},
                enable: true
            },
            callback: {
                onCheck: zTreeOnCheck,
                beforeClick: zTreeBeforeClick
            }
        };
        $.ajax({
            url: server.ip + "/system/getCDUAll.json",
            data: JSON.stringify({}),
            success: function (r) {
                var nodes = r.data.sendData;
                var newList=[];
                for (var i = 0; i < nodes.length; i++) {

                    if (nodes[i].roleName != "财务/审计副总裁"&&nodes[i].roleName != "财务经理"&&nodes[i].roleName != "财务出纳"&&nodes[i].roleName != "审计专员") {
                        if (nodes[i].name == "收件箱") {
                            nodes[i].name = "组织机构";
                        }
                        newList.push(nodes[i])
                    }else{
                        console.log( nodes[i])
                    }

                }
                app.treeObj = $.fn.zTree.init($("#ulRegion"), zTreeRegion_setting, newList);

            }
        });

        function zTreeBeforeClick(treeId, treeNode, clickFlag) {
            app.treeObj.checkNode(treeNode, '', true);
            return false;
        }

        function zTreeOnCheck(treeId, treeNode) {
            console.log(treeNode);
            var receivers = new Array();
            var Nodes = app.treeObj.getCheckedNodes(true);
            for (var i = 0; i < Nodes.length; i++) {
                if (Nodes[i].type == "user") {
                    receivers.push(Nodes[i].name + "; ");
                }
            }

        };
    });
</script>


<script type="text/javascript">

    var query = null;
    var app = new Vue({
        el: '#app',
        data: {

            mainId: getUrlParamObj().mainId,
            selectTree: 0,
            selectBox: {
                companyList: [],
                departList: [],
                roleList: [],
                selectCompany: [],
                companyNames: [],
                departNames: [],
                roleNames: [],
                companyIds: [],
                userIds: []
            },
            userModel: false,
            lookUserModel: false,
            lookUserList: [],
            treeObj: "",
            userId: getUrlParamObj().userId,
            userInfo: {},
            date: "",
            mainInfo: {},
            tabList: [],
            createAudit: [],
            info: {
                type: 2,
                createAuditors: [],
                auditors: [],
                auditFlag: "-5",
                auditInfo: "",
                title: "",
                content: "",
                endTime: '',
                uploadTime: '',
                voteUsers: "",
                createUserId: getUrlParamObj().userId,
                companyId: "",
                createUserName: "",
                voteThemeList: [
                    {
                        "title": "",
                        "value": [
                            {"title": "", "disa": true, "attrUrl": "", "attrName": ""},
                            {"title": "", "disa": true, "attrUrl": "", "attrName": ""},
                            {"title": "", "disa": true, "attrUrl": "", "attrName": ""},
                            {"title": "", "disa": true, "attrUrl": "", "attrName": ""}
                        ]
                    }
                ]
            },
            isGo: true,
            isOpenBtn: false
        },
        methods: {
            formatDate: function (now) {
                if (now) {
                    return new Date(now).Format(TimeFormat.middle)
                }
            },
            audit: function (type) {
                var _this = this;
                if (type == '2') {

                    var param = {
                        data: '1',
                        title: '请输入驳回原因',
                        hint: '请输入驳回原因',
                        tipMsg: '请输入驳回原因',
                        confirmText: "确认",
                        cancelable: true
                    }
                    _this.inputResult = "等待输入..."
                    JSBridge.call(UI, 'showInputDialog', param, function (res) {
                        var res = res.sendData.content
                        if (!res || res == '无' || $.trim(res) == '') {
                            JSBridge.call(UI, 'showToast', {title: "请简述理由"})
                            return false;
                        }
                        if (_this.isGo) {
                            var data = {
                                id: _this.mainId,
                                auditFlag: 2,
                                userId: _this.userInfo.id,
                                advise: res
                            }
                            _this.isGo = false;
                            $.wyui.postMethod("/vote/applyCreateAudit.json", data, function (r) {
                                _this.isGo = true;
                                JSBridge.call(UI, 'hideLoading')
                                JSBridge.call(UI, 'showToast', {title: "驳回成功！"})

                                var param = {
                                    backRefresh: true,       //是否返回刷新
                                }
                                JSBridge.call(ROUTER, 'navigateBack', param)

                            });
                        }
                    })
                } else {
                    var param = {
                        title: "提示",
                        content: "确定要通过吗",
                        cancelText: "取消",
                        confirmText: "确定",
                        showCancel: true,
                        cancelable: false
                    }
                    _this.dialogResult = "等待选择..."
                    JSBridge.call(UI, 'showDialog', param, function (res) {
                        if ('确定' == res.sendData.data) {
                            JSBridge.call(UI, 'showLoading', {})
                            if (_this.isGo) {
                                var data = {
                                    id: _this.mainId,
                                    auditFlag: 1,
                                    userId: _this.userInfo.id,
                                    advise: '同意！'
                                }
                                _this.isGo = false;
                                $.wyui.postMethod("/vote/applyCreateAudit.json", data, function (r) {
                                    _this.isGo = true;
                                    JSBridge.call(UI, 'hideLoading')
                                    JSBridge.call(UI, 'showToast', {title: "审核成功！"})

                                    var param = {
                                        backRefresh: true,       //是否返回刷新
                                    }
                                    JSBridge.call(ROUTER, 'navigateBack', param)

                                });
                            }
                        }
                    })
                }
            },
            openVote: function () {
                var that = this;
                var _this = this;
                var param = {
                    title: "提示",
                    content: "确认所有参投文件上传无误，提前开始投票？",
                    cancelText: "取消",
                    confirmText: "确定",
                    showCancel: true,
                    cancelable: false
                }
                _this.dialogResult = "请等待..."
                JSBridge.call(UI, 'showDialog', param, function (res) {
                    if ('确定' == res.sendData.data) {
                        JSBridge.call(UI, 'showLoading', {})
                        if (_this.isGo) {
                            var data = {
                                id: that.mainId,
                                type: '-1'
                            }
                            _this.isGo = false;
                            $.wyui.postMethod('/vote/updateVote.json', data, function (data) {
                                _this.isGo = true;
                                JSBridge.call(UI, 'hideLoading')
                                JSBridge.call(UI, 'showToast', {title: "投票已提前开始！"})
                                var param = {
                                    backRefresh: true,       //是否返回刷新
                                }
                                JSBridge.call(ROUTER, 'navigateBack', param)
                            })

                        }

                    } else {

                    }
                })

            },
            tablesMergeCell: function (list) {
                for (field in list[0]) {
                    var k = 0;
                    while (k < list.length) {
                        list[k][field + 'span'] = 1;
                        list[k][field + 'dis'] = false;
                        for (var i = k + 1; i <= list.length - 1; i++) {

                            if (list[k][field] == list[i][field] && list[k][field] != '') {
                                if (field == 'departName') {
                                    if (list[k].companyName == list[i].companyName) {
                                        list[k][field + 'span']++;
                                        list[k][field + 'dis'] = false;
                                        list[i][field + 'span'] = 1;
                                        list[i][field + 'dis'] = true;
                                    }
                                }
                                else if (field == 'roleName') {
                                    if (list[k].companyName == list[i].companyName && list[k].departName == list[i].departName) {
                                        list[k][field + 'span']++;
                                        list[k][field + 'dis'] = false;
                                        list[i][field + 'span'] = 1;
                                        list[i][field + 'dis'] = true;
                                    }
                                } else {
                                    list[k][field + 'span']++;
                                    list[k][field + 'dis'] = false;
                                    list[i][field + 'span'] = 1;
                                    list[i][field + 'dis'] = true;
                                }

                            } else {
                                break;
                            }
                        }
                        k = i;
                    }
                }
                return list;
            },
            lookUser: function () {
                var that = this;
                that.lookUserModel = true;
                var param = {
                    enableNavigateBack: false,
                }
                JSBridge.call(UI, 'setEnableNavigateBack', param)
                JSBridge.call(UI, 'showLoading', {})

                $.wyui.postMethod('/vote/lookUserList.json', {userIds: that.info.voteUsers}, function (data) {
                    that.lookUserList = that.tablesMergeCell(data.List);
                    that.hideLoading();
                })
            },
            closeModel: function () {
                this.lookUserModel = false;
                var param = {
                    enableNavigateBack: true,
                }
                JSBridge.call(UI, 'setEnableNavigateBack', param)
            },
            getAuditors: function () {
                var that = this;
                $.wyui.postMethod('/vote/getAuditList.json', {
                    userId: that.userInfo.id,
                    companyId: that.userInfo.companyId,
                    roleName: that.userInfo.roleName
                }, function (data) {
                    that.info.auditors = data.auditors;
                    that.info.createAuditors = data.createAuditors;
                    if (!data.createAuditors || data.createAuditors.length == 0) {
                        that.info.auditFlag = '-2'
                    }

                })
            },
            getCompanyList: function () {
                var that = this;
                $.wyui.postMethod('/company/getCompanyByUserId.json', {userId: '201711271733404C9DA1461F2421F828'}, function (data) {
                    var isgo = false;
                    for (var i = 0; i < data.length; i++) {
                        if (that.selectBox.companyIds.indexOf(data[i].id) != -1) {
                            isgo = true;
                            data[i].select = true
                        } else {
                            data[i].select = false
                        }
                    }
                    that.selectBox.companyList = data
                    if (isgo) {
                        that.selectDepart();

                    }
                })
            },
            getUserIds: function () {
                var that = this;
                $.wyui.postMethod('/exam/getUserList.json', {
                    companyIds: that.selectBox.companyIds.join(','),
                    departNames: that.selectBox.departNames.join(','),
                    pageSize: 500,
                    requestPage: 1,
                    roleNames: that.selectBox.roleNames.join(',')

                }, function (data) {
                    var list = data.records;
                    var userIds = [];
                    if (list.length > 0) {
                        for (var i = 0; i < list.length; i++) {
                            userIds.push(list[i].userId)
                        }
                    }
                    that.selectBox.userIds = userIds;
                    console.log(that.selectBox.userIds);
                })
            },
            selectItem: function (item, type) {
                var check;
                if (type == '1') {
                    check = "companyIds"
                    this.checkedOne(check, item.id);
                } else if (type == '2') {
                    check = "departNames"
                    this.checkedOne(check, item.departName);
                } else {
                    check = "roleNames"
                    this.checkedOne(check, item.roleName);
                }
                if (item.select == true) {
                    item.select = false
                } else {
                    item.select = true
                }
                console.log(item)
            },
            checkedOne: function (checkList, moduleKey) {
                var that = this;
                var idIndex = this.selectBox[checkList].indexOf(moduleKey)
                if (idIndex >= 0) {
                    this.selectBox[checkList].splice(idIndex, 1)
                } else {
                    this.selectBox[checkList].push(moduleKey)
                }
                if (checkList == 'companyIds') {
                    if (that.selectBox.companyIds.length == 0) {
                        that.selectBox.departList = [];
                        that.selectBox.departNames = [];
                        that.selectBox.roleList = [];
                    }
                    that.selectDepart()

                }
                if (checkList == 'departNames') {
                    if (that.selectBox.departNames.length == 0) {
                        that.selectBox.roleList = [];
                        that.selectBox.roleNames = [];
                    }

                    that.selectRoleName()
                }
                if (checkList == 'roleNames') {
                    if (that.selectBox.roleNames.length > 0) {
                        that.getUserIds();
                    } else {
                        that.selectBox.userIds = [];
                    }
                }

            },
            hideLoading: function () {
                JSBridge.call(UI, 'hideLoading')
            },
            changeTree: function () {
                var that = this;
                JSBridge.call(UI, 'showLoading', {})
                setTimeout(function () {
                    that.hideLoading()
                }, 2000)
                if (that.selectBox.userIds.length > 0) {
                    var userIdsStr = that.selectBox.userIds.join(',')
                    this.treeObj.getNodesByFilter(function (node) {
                        if (userIdsStr.indexOf(node.id) > -1) {
                            console.log(node.id)
                            that.treeObj.checkNode(node, true, true, false);
                        } else {
                            that.treeObj.checkNode(node, false, false, false);
                        }
                    });
                }

            },
            selectDepart: function () {
                var that = this;
                if (that.selectBox.companyIds.length > 0) {
                    var companyIds = that.selectBox.companyIds.join(',');
                    $.wyui.postMethod('/exam/getDepartListByCompanyIds.json', {companyIds: companyIds}, function (data) {
                        var isgo = false;
                        var newList = [];
                        console.log(data)
                        for (var i = 0; i < data.result.length; i++) {
                            if (that.selectBox.departNames.indexOf(data.result[i].departName) != -1) {
                                data.result[i].select = true;
                                newList.push(data.result[i].departName)
                                isgo = true
                            } else {
                                data.result[i].select = false
                            }
                        }
                        that.selectBox.departNames = newList;
                        that.selectBox.departList = data.result

                        if (isgo) {
                            that.selectRoleName();
                        } else {
                            that.selectBox.roleNames = [];
                            for (var i = 0; i < that.selectBox.roleList.length; i++) {
                                that.selectBox.roleList[i].select = false;
                            }
                        }
                    })
                }
            },
            selectRoleName: function () {
                var that = this;
                if (that.selectBox.departNames.length > 0) {
                    var companyIds = that.selectBox.companyIds.join(',');
                    var departNames = that.selectBox.departNames.join(',');
                    $.wyui.postMethod('/exam/getRoleNameListByCompanyAndDepart.json', {
                        companyIds: companyIds,
                        departNames: departNames
                    }, function (data) {
                        console.log(data);
                        var newList = [];
                        for (var i = 0; i < data.result.length; i++) {
                            if (that.selectBox.roleNames.indexOf(data.result[i].roleName) != -1) {
                                data.result[i].select = true;
                                newList.push(data.result[i].roleName)
                            } else {
                                data.result[i].select = false
                            }
                        }
                        that.selectBox.roleNames = newList;
                        that.selectBox.roleList = data.result
                    })
                }
            },
            lookFj: function (url) {
                var that = this
                var param = {
                    url: url,
                }
                JSBridge.call(FILE, 'showFile', param)
            },
            showToast: function (title) {
                var param = {
                    title: title
                }
                JSBridge.call(UI, 'showToast', param)
            },

            fjStyle: function (fjName) {
                if (fjName) {
                    var type = fjName.substring(fjName.lastIndexOf('.') + 1);
                    return 'img fj-' + type
                }
                return 'img'
            },
            showModel: function () {
                this.userModel = true;
                var param = {
                    enableNavigateBack: false,
                }
                JSBridge.call(UI, 'setEnableNavigateBack', param)
            },
            saveUser: function () {
                var param = {
                    enableNavigateBack: true,
                }
                JSBridge.call(UI, 'setEnableNavigateBack', param)
                var that = this;
                var _this = this;
                JSBridge.call(UI, 'showLoading', {})
                if (this.selectTree == '1') {
                    $.wyui.postMethod('/exam/getUserList.json', {
                        companyIds: that.selectBox.companyIds.join(','),
                        departNames: that.selectBox.departNames.join(','),
                        pageSize: 500,
                        requestPage: 1,
                        roleNames: that.selectBox.roleNames.join(',')

                    }, function (data) {
                        var list = data.records;
                        var userIds = [];
                        if (list.length > 0) {
                            for (var i = 0; i < list.length; i++) {
                                userIds.push(list[i].userId)
                            }
                        }
                        that.selectBox.userIds = userIds;
                        if (that.selectBox.userIds.length > 0) {
                            that.info.voteUsers = that.selectBox.userIds.join(',')
                        } else {
                            that.info.voteUsers = '';
                        }
                    }, true)


                } else {
                    searchTree(true)
                    var receivers = new Array();
                    var Nodes = this.treeObj.getCheckedNodes(true);

                    for (var i = 0; i < Nodes.length; i++) {
                        if (Nodes[i].type == "user") {
                            receivers.push(Nodes[i].id);
                        }
                    }
                    if (receivers.length > 0) {
                        this.info.voteUsers = receivers.join(',')
                    } else {
                        this.info.voteUsers = '';
                    }
                }
                //如果是修改
                if (_this.mainId && _this.mainInfo.auditFlag != '-4') {
                    //修改
                    //人员有变化 调用保存
                    if (this.isGo) {
                        var data = {
                            voteUsers: _this.info.voteUsers,
                            id: _this.mainId,
                            companyIds: _this.selectBox.companyIds.join(","),
                            roleNames: _this.selectBox.roleNames.join(","),
                            departNames: _this.selectBox.departNames.join(",")
                        }
                        this.isGo = false;
                        var param = {
                            title: "加载中...",
                        }
                        $.wyui.postMethod("/vote/saveVote.json", data, function (r) {
                            _this.isGo = true;
                            that.userModel = false;
                            JSBridge.call(UI, 'hideLoading')
                        });
                    } else {
                        JSBridge.call(UI, 'hideLoading')
                    }
                } else {
                    that.userModel = false;
                    setTimeout(function () {
                        that.hideLoading()
                    }, 1500)

                }
            },
            inputInTitle: function (e) {
                var that = this;
                if (that.info.title) {
                    that.info.voteThemeList[0].value[0].disa = false;
                } else {
                    that.info.voteThemeList[0].value[0].disa = true;
                }
            },
            hideTs: function (e, index, index2) {
                var that = this;
                var data = that.info.voteThemeList[index].value[index2].title;
                if (data) {
                    if (that.info.voteThemeList[index].value[index2 + 1]) {
                        that.info.voteThemeList[index].value[index2 + 1].disa = false;
                    }
                } else {
                    that.info.voteThemeList[index].value[index2 + 1].disa = true;
                }
            },
            hideYz: function (index, index2) {
                var that = this;
                if (that.info.title == "") {
                    this.info.voteThemeList[index].value[index2].title = "";
                    JSBridge.call(UI, 'showToast', {title: "请先填写投票标题"})
                    return false;
                    $("#titleInput").focus();
                } else {
                    var data = this.info.voteThemeList[index]
                    for (b = 0; b < index2; b++) {
                        if (data.value[b].title == "") {
                            this.info.voteThemeList[index].value[index2].title = "";
                            JSBridge.call(UI, 'showToast', {title: "请按顺序填写被投票对象"})
                            $('#input' + b).focus();
                            return false;
                        }
                    }
                }
            },
            check: function (e, index, index2) {
                var that = this;
                var data = this.info.voteThemeList[index].value[index2].title
                data = $.trim(data)
                if (data) {
                    $.wyui.postMethod("/vote/checkName.json", {"name": data}, function (res) {
                        if (!res.flag) {
                            console.log(e)
                            $(e).focus();
                            $(e).parent().find(".yz").show();
                            that.info.voteThemeList[index].value[index2].title = '';
                        }

                    });

                }

            },
            getCreateAudit: function () {
                var _this = this; //声明一个变量指向Vue实例this，保证作用域一致
                $.wyui.postMethod("/vote/getMainInfoById.json", {"mainId": _this.mainId}, function (res) {
                    console.log(res)
                    _this.createAudit = res.createAudit;
                });
            },

            number2big: function (number) {
                switch (Number(number)) {
                    case 1:
                        return '一';
                        break;
                    case 2:
                        return '二';
                        break;
                    case 3:
                        return '三';
                        break;
                    case 4:
                        return '四';
                        break;
                    case 5:
                        return '五';
                        break;
                    case 6:
                        return '六';
                        break;
                    case 7:
                        return '七';
                        break;
                    case 8:
                        return '八';
                        break;
                    case 9:
                        return '九';
                        break;
                    case 10:
                        return '十';
                        break;
                    case 11:
                        return '十一';
                        break;
                    case 12:
                        return '十二';
                        break;
                    case 13:
                        return '十三';
                        break;
                    case 14:
                        return '十四';
                        break;
                    case 15:
                        return '十五';
                        break;
                    case 16:
                        return '十六';
                        break;
                    case 17:
                        return '十七';
                        break;
                    case 18:
                        return '十八';
                        break;
                    case 19:
                        return '十九';
                        break;
                    case 20:
                        return '二十';
                        break;
                }
            },

            returnList: function () {
                var _this = this;
                var param = {
                    backRefresh: true,       //是否返回刷新
                }
                JSBridge.call(ROUTER, 'navigateBack', param)
            },
            save: function (type) {
                var _this = this;

                if (_this.mainId) {
                    if(!_this.mainInfo.createUserId){
                        this.info.createUserId = this.userInfo.id;
                        this.info.createUserName = this.userInfo.name;
                        this.info.companyId = this.userInfo.companyId;
                    }
                    _this.updateInfo(type);

                } else {
                    if (this.isGo) {
                        if(type==1){
                            this.info.auditFlag='-5'
                        }else{
                            this.info.auditFlag='-3'
                        }
                        var time = $("#time").val()
                        var time2 = $("#time2").val()


                        var _this = this;
                        if (this.info.title == "") {
                            JSBridge.call(UI, 'showToast', {title: "请填写投票标题"})
                            return false;
                        }
                        if(!type||(type&&type!==1)){
                            var newList = [];
                            for (var i = 0; i < this.info.voteThemeList.length; i++) {
                                var data = this.info.voteThemeList[i]
                                for (b = 0; b < data.value.length; b++) {
                                    if (data.value[b].title != "") {
                                        newList.push(data.value[b])
                                    }

                                }
                            }
                            if (newList < 2) {
                                JSBridge.call(UI, 'showToast', {title: "请至少添加俩个参投人员"})
                                return false;
                            }
                            data.value = newList;

                            if (time2 == "") {
                                JSBridge.call(UI, 'showToast', {title: "请选择参投文件上传截止时间"})
                                return false;
                            }
                            if (time == "") {
                                JSBridge.call(UI, 'showToast', {title: "请选择截止时间"})
                                return false;
                            }

                            if (this.info.voteUsers == "") {
                                JSBridge.call(UI, 'showToast', {title: "请选择投票人员"})
                                return false;
                            }
                        }
                        if(time){
                            this.info.endTime = time;
                        }
                        if(time2){
                            this.info.uploadTime = time2;
                        }

                        this.info.companyIds = this.selectBox.companyIds.join(",");
                        this.info.roleNames = this.selectBox.roleNames.join(",");
                        this.info.departNames = this.selectBox.departNames.join(",");

                        this.info.createUserId = this.userInfo.id;
                        this.info.createUserName = this.userInfo.name;
                        this.info.companyId = this.userInfo.companyId;
                        this.isGo = false;
                        var title='创建中...';
                        if(type&&type==1){
                            title='保存草稿中...'
                        }
                        var param = {
                            title: title,
                        }
                        JSBridge.call(UI, 'showLoading', param)
                        $.wyui.postMethod("/vote/saveVote.json", _this.info, function (r) {
                            _this.isGo = true;
                            JSBridge.call(UI, 'hideLoading')
                            if (r.id) {
                                if(type&&type==1){
                                    JSBridge.call(UI, 'showToast', {title: "保存草稿成功"})
                                }else{
                                    JSBridge.call(UI, 'showToast', {title: "创建完成"})
                                }
                                var param = {
                                    backRefresh: true,       //是否返回刷新
                                }
                                JSBridge.call(ROUTER, 'navigateBack', param)

                            } else {
                                JSBridge.call(UI, 'showToast', {title: "系统内容异常，请联系IT人员"})
                            }
                        });
                    }
                }

            },
            updateInfo: function (type) {
                if (this.isGo) {
                    if(type){
                        if(type==1){
                            this.info.auditFlag='-5'
                        }else{
                            this.info.auditFlag='-3'
                        }
                    }
                    var time = $("#time").val()
                    var time2 = $("#time2").val()

                    var _this = this;
                    if (this.info.title == "") {
                        JSBridge.call(UI, 'showToast', {title: "请填写投票标题"})
                        return false;
                    }
                    if(!type||(type&&type!==1)){
                        for (var i = 0; i < this.info.voteThemeList.length; i++) {
                            var data = this.info.voteThemeList[i]
                            for (b = 0; b < data.value.length; b++) {
                                if (data.value[b].title == "") {
                                    JSBridge.call(UI, 'showToast', {title: "被投票对象不能为空"})
                                    return false;
                                }
                            }
                        }
                        if (time2 == "") {
                            JSBridge.call(UI, 'showToast', {title: "请选择参投文件上传截止时间"})
                            return false;
                        }
                        if (time == "") {
                            JSBridge.call(UI, 'showToast', {title: "请选择截止时间"})
                            return false;
                        }

                        if (this.info.voteUsers == "") {
                            JSBridge.call(UI, 'showToast', {title: "请选择投票人员"})
                            return false;
                        }
                    }

                    if(time){
                        this.info.endTime = time;
                    }
                    if(time2){
                        this.info.uploadTime = time2;
                    }

                    this.info.companyIds = this.selectBox.companyIds.join(",");
                    this.info.roleNames = this.selectBox.roleNames.join(",");
                    this.info.departNames = this.selectBox.departNames.join(",");

                    this.info.createUserId = this.userInfo.id;
                    this.info.createUserName = this.userInfo.name;
                    this.info.companyId = this.userInfo.companyId;
                    this.isGo = false;

                    var param = {
                        title: "修改中...",
                    }
                    JSBridge.call(UI, 'showLoading', param)
                    $.wyui.postMethod("/vote/saveVote.json", _this.info, function (r) {
                        _this.isGo = true;
                        JSBridge.call(UI, 'hideLoading')
                        if (r.id) {
                            if(type&&type==1){
                                JSBridge.call(UI, 'showToast', {title: "保存草稿成功"})
                            }else{
                                JSBridge.call(UI, 'showToast', {title: "创建完成"})
                            }
                            var param = {
                                backRefresh: true,       //是否返回刷新
                            }
                            JSBridge.call(ROUTER, 'navigateBack', param)

                        } else {
                            JSBridge.call(UI, 'showToast', {title: "系统内容异常，请联系IT人员"})
                        }
                    });
                }
            },
            addAnswer: function () {
                if (this.info.voteThemeList[0].value.length >= 20) {
                    JSBridge.call(UI, 'showToast', {title: "最多设置20个被投票对象"})
                    return false;
                }
                var data = this.info.voteThemeList[0];
                var flag = false;
                if (data && data.value.length > 0) {
                    for (b = 0; b < data.value.length; b++) {
                        if (data.value[b].title == "") {
                            this.info.voteThemeList[0].value[b].title = "";
                            flag = true;
                            break;
                        }
                    }
                }
                if (flag) {
                    this.info.voteThemeList[0].value.push({"title": "", "disa": true, "attrUrl": "", "attrName": ""})
                } else {
                    this.info.voteThemeList[0].value.push({"title": "", "disa": false, "attrUrl": "", "attrName": ""})
                }
                //this.info.voteThemeList[0].value.push({ "title": "", "disa": true,"attrUrl":"","attrName":""})

            },
            uploadFile: function (index, index2) {
                var that = this
                JSBridge.call(FILE, 'uploadFile', {}, function (res) {
                    var data = res.sendData;
                    that.info.voteThemeList[index].value[index2].attrUrl = data.url;
                    that.info.voteThemeList[index].value[index2].attrName = data.name;
                })
            },
            deleteFile: function (index, index2) {
                var that = this;
                var param = {
                    title: "提示",
                    content: "确定要删除该附件吗",
                    cancelText: "取消",
                    confirmText: "确定",
                    showCancel: true,
                    cancelable: false
                }
                that.dialogResult = "等待选择..."
                JSBridge.call(UI, 'showDialog', param, function (res) {
                    if ('确定' == res.sendData.data) {
                        that.info.voteThemeList[index].value[index2].attrUrl = '';
                        that.info.voteThemeList[index].value[index2].attrName = '';
                    } else {

                    }
                })

            },
            removeAnswer: function (index, index2) {
                var that = this;
                if (this.info.voteThemeList[index].value.length <= 2) {
                    JSBridge.call(UI, 'showToast', {title: "最少保留俩个被投票对象"})
                    return false;
                }
                if (this.info.voteThemeList[index].value[index2].title || this.info.voteThemeList[index].value[index2].attrName) {
                    var param = {
                        title: "提示",
                        content: "确定要删除该投票对象吗？",
                        cancelText: "取消",
                        confirmText: "确定",
                        showCancel: true,
                        cancelable: false
                    }
                    that.dialogResult = "等待选择..."
                    JSBridge.call(UI, 'showDialog', param, function (res) {
                        if ('确定' == res.sendData.data) {
                            that.info.voteThemeList[index].value.splice(index2, 1);
                        } else {

                        }
                    })
                } else {
                    this.info.voteThemeList[index].value.splice(index2, 1);
                }


            },
            get_search: function () {
                clearTimeout(query);
                query = setTimeout(function () {
                    searchTree()
                }, 1000);
            }
        },
        mounted: function () {
            var _this = this; //声明一个变量指向Vue实例this，保证作用域一致
            var that = this;
            JSBridge.call(UI, 'showLoading', {})
            $.wyui.postMethod("/vote/getUserInfoByUserId.json", {id: _this.userId}, function (info) {
                _this.userInfo = info.userInfo;
                _this.getAuditors();
                JSBridge.call(UI, 'hideLoading')
            });
            if (that.mainId) {
                $.wyui.postMethod("/vote/getThemeList.json", {
                    "mainId": that.mainId,
                    "tel": that.userInfo.tel,
                    "userId": _this.userId
                }, function (res) {
                    var result = res.result;
                    var $body = $('body');
                    document.title = res.main.title;
                    var $iframe = $('<iframe src="/dist/img/icon.png"></iframe>');
                    $iframe.on('load', function () {
                        setTimeout(function () {
                            $iframe.off('load').remove();
                        }, 0);
                    }).appendTo($body);

                    that.mainInfo = res.main;


                    if (res.main.auditFlag == '-4'||res.main.auditFlag == '-5') {
                        console.log(res.result)
                        that.info.voteThemeList[0].value = [];
                        for (var i = 0; i < res.result[0].optionList.length; i++) {
                            var data = res.result[0].optionList[i];
                            that.info.voteThemeList[0].value.push(
                                {"title": data.description, "disa": false, "attrUrl": data.attrUrl, "attrName": data.attrName}
                            )
                        }
                        setTimeout(function () {
                            $("#time2").val(res.main.uploadTime);
                            $("#time").val(res.main.endTime);
                        }, 300)
                        console.log($("#time2"))

                        that.info.id = res.main.id;
                        that.info.type = res.main.type;
                        that.info.title = res.main.title;
                        that.info.endTime = res.main.endTime;
                        that.info.uploadTime = res.main.uploadTime;

                    }
                    JSBridge.call(UI, 'hideLoading')

                    that.getCreateAudit();

                    that.info.voteUsers = res.main.voteUsers;
                    that.selectBox.companyIds = res.main.companyIds.split(',')
                    that.getCompanyList();
                    that.selectBox.departNames = res.main.departNames.split(',')
                    that.selectBox.roleNames = res.main.roleNames.split(',')

                    if (that.treeObj.getNodesByFilter) {

                        that.treeObj.getNodesByFilter(function (node) {
                            if (res.main.voteUsers.indexOf(node.id) > -1) {
                                that.treeObj.checkNode(node, true, true, false);
                            } else {
                                that.treeObj.checkNode(node, false, false, false);
                            }
                        });
                    } else {


                        console.log("网不好 延迟加载")
                        setTimeout(function () {
                            that.treeObj.getNodesByFilter(function (node) {
                                if (res.main.voteUsers.indexOf(node.id) > -1) {
                                    that.treeObj.checkNode(node, true, true, false);
                                } else {
                                    that.treeObj.checkNode(node, false, false, false);
                                }
                            });
                        }, 3000)
                    }


                    if (result && result.length > 0) {
                        that.tabList = result[0].optionList;
                        for (var i = 0; i < that.tabList.length; i++) {
                            if (that.tabList[i].attrUrl) {
                                that.tabList[i].attrUrlList = that.tabList[i].attrUrl.split(';');
                                that.tabList[i].attrNameList = that.tabList[i].attrName.split(';');
                            } else {
                                that.tabList[i].attrUrlList = [];
                                that.tabList[i].attrNameList = [];
                            }
                        }
                        var isOpenBtn = true;
                        for (var b = 0; b < result[0].optionList.length; b++) {

                            if (result[0].optionList[b].attrUrl == '') {
                                isOpenBtn = false;
                            }
                        }
                        that.isOpenBtn = isOpenBtn;
                    }

                });
            } else {
                that.hideLoading()
                _this.getCompanyList();
            }


            //页面初次加载  执行客户分页列表
        }
    });

</script>
<script>

    $(".search-button").on('click', function () {
        searchTree()
    });

    function searchTree(type) {
        var text = ''
        if (type) {
            text = '';
        } else {
            text = $(".selecetInput").val();

        }

        if (text != "") {
            var allNode = app.treeObj.transformToArray(app.treeObj.getNodes());
            ;
            app.treeObj.hideNodes(allNode);
            nodeList = app.treeObj.getNodesByParamFuzzy("name", text);
            nodeList = app.treeObj.transformToArray(nodeList);
            for (var n in nodeList) {
                app.treeObj.selectNode(nodeList[n], true);
                findParent(app.treeObj, nodeList[n]);
            }
            app.treeObj.showNodes(nodeList);

        } else {
            var allNode = app.treeObj.transformToArray(app.treeObj.getNodes());
            ;
            app.treeObj.showNodes(allNode);
            app.treeObj.cancelSelectedNode();
            app.treeObj.expandAll(false);
            for (var index in allNode) {
                if (allNode[index].level < 2) {
                    app.treeObj.expandNode(allNode[index], true, false, false);
                }
            }

        }
    }

    function findParent(treeObj, node) {
        treeObj.expandNode(node, true, false, false);
        var pNode = node.getParentNode();
        if (pNode != null) {
            nodeList.push(pNode);
            findParent(treeObj, pNode);
        }
    }


</script>
<script>
    //接收其他页面传递的参数
    function onParamReceived(param) {
        app.info.voteUsers = param;
    }
</script>
<script>
    //禁用返回键后,点击app返回键回调
    function onBackPressed(enableNavigateBack) {
        if (!enableNavigateBack) {
            app.userModel = false;
            app.lookUserModel = false;
            var param = {
                enableNavigateBack: true,
            }
            JSBridge.call(UI, 'setEnableNavigateBack', param)
        } else {
//            JSBridge.call(UI, 'refresh')
        }
    }
</script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    var url = location.href.split('#').toString();
    var title = "创建投票";
    var discuss = "滚滚向前投票助手";
    var shareImgUrl = 'http://oa.yingfeng365.com/dist/img/tplgo.png';
    var timestamp;
    var noncestr;
    var signature;
    //获取签名
    $.ajax({
        type: "GET",
        url: server.ip + "/wshare/getSignature.json",
        //data:{timestamp:timestamp,noncestr:noncestr,url:url},
        data: {url: url},
        success: function (data) {
            console.log("success");
            var objData = data;
            timestamp = objData.timestamp;
            noncestr = objData.noncestr;
            signature = objData.signature;
            console.log(objData);
            wxShare();
        },
        statusCode: {
            404: function () {
                alert('page not found');
            }
        }
    });

    function wxShare() {
        wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: 'wx687174fc0632009d', // 和获取Ticke的必须一样------必填，公众号的唯一标识
            timestamp: timestamp, // 必填，生成签名的时间戳
            nonceStr: noncestr, // 必填，生成签名的随机串
            signature: signature,// 必填，签名，见附录1
            jsApiList: [
                'onMenuShareAppMessage', 'onMenuShareTimeline'
            ] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
        });
    }

    wx.ready(function () {
        //config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，
        //config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关
        //接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
        //----------“分享给朋友”
        wx.onMenuShareAppMessage({
            title: title, // 分享标题
            desc: discuss, // 分享描述
            link: url, // 分享链接
            imgUrl: shareImgUrl, // 分享图标
            success: function () {
                console.log("1")
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });
        //------------"分享到朋友圈"
        wx.onMenuShareTimeline({
            title: title, // 分享标题
            desc: discuss, // 分享描述
            link: url, // 分享链接
            imgUrl: shareImgUrl, // 分享图标
            type: '', // 分享类型,music、video或link，不填默认为link
            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
            success: function () {


                // 用户确认分享后执行的回调函数、
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });


    });
    wx.error(function (res) {
        // config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名。
        console.log(res);
    });
</script>

<script>
    "use strict";

    //默认设置

    var _createClass = (function () {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || false;
                descriptor.configurable = true;
                if ("value" in descriptor) descriptor.writable = true;
                Object.defineProperty(target, descriptor.key, descriptor);
            }
        }

        return function (Constructor, protoProps, staticProps) {
            if (protoProps) defineProperties(Constructor.prototype, protoProps);
            if (staticProps) defineProperties(Constructor, staticProps);
            return Constructor;
        };
    })();

    function _classCallCheck(instance, Constructor) {
        if (!(instance instanceof Constructor)) {
            throw new TypeError("Cannot call a class as a function");
        }
    }

    var DEFAULT_OPTIONS = {
        appointDays: 7, //设置可以预约未来7天
        preTime: 10, //设置只能预约20分钟之后,如果两个小时就填120
        disMinute: 20 //分钟的间隔，设置十分钟
    };

    function datePicker() {
        var options =
            arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

        //最终的设置
        var CHOICE_OPTIONS = Object.assign({}, options, DEFAULT_OPTIONS),
            app = CHOICE_OPTIONS.appointDays,
            pre_min = CHOICE_OPTIONS.preTime % 60,
            dism = CHOICE_OPTIONS.disMinute,
            pre_hour = Math.floor(DEFAULT_OPTIONS.preTime / 60);

        var daysArr = [],
            hoursArr = [],
            minutesArr = [],
            //最终选择时间
            selectedYear = "",
            selectedDay = "",
            selectedHour = "",
            selectedMinute = "",
            //初始化时间
            initHour = void 0,
            initMinute = void 0,
            initHourArr = [],
            initMinuteArr = [],
            isToday = true,
            //初始化时间并获得当前时间
            date = new Date(),
            currentYear = date.getFullYear(),
            currentMonth = date.getMonth() + 1,
            currentDay = date.getDate(),
            currentHours = date.getHours() + pre_hour,
            currentMinutes = date.getMinutes();

        //筛选符合条件的时间
        var filterDate = (function (f) {
            //获取当前月有多少天
            var DayNumOfMonth = new Date(currentYear, currentMonth, 0).getDate(),
                //获取daysArr
                remainDay = DayNumOfMonth - currentDay,
                timeStamp = Date.now();

            for (var i = 0; i < app; i++) {
                var preStamp = timeStamp + 24 * 60 * 60 * 1000 * i,
                    _date = new Date(preStamp),
                    preYear = _date.getFullYear(),
                    preMonth = _date.getMonth() + 1,
                    preDay = _date.getDate();
                switch (i) {
                    case 0:
                        daysArr.push(
                            "\u4ECA\u5929(" + preMonth + "\u6708" + preDay + "\u65E5)"
                        );
                        break;
                    case 1:
                        daysArr.push(
                            "\u660E\u5929(" + preMonth + "\u6708" + preDay + "\u65E5)"
                        );
                        break;
                    case 2:
                        daysArr.push(
                            "\u540E\u5929(" + preMonth + "\u6708" + preDay + "\u65E5)"
                        );
                        break;
                    default:
                        daysArr.push(preMonth + "\u6708" + preDay + "\u65E5");
                        break;
                }
            }

            //如果是今天的23:30以后,那么今天的就不能选择
            if (currentHours == 23 && currentMinutes >= 60 - pre_min) {
                daysArr.shift();
            }

            for (var _i = currentHours; _i < 24; _i++) {
                hoursArr.push(_i);
                initHourArr.push(_i);
            }

            //如果当前的分钟超过pre_min(假设pre_min=30),则小时只能从下一个小时选择,当前时间3:40=>4:10
            if (currentMinutes + pre_min > 60 - dism) {
                hoursArr.shift();
                initHourArr.shift();
            }

            //如果hoursArr没有数据,说明今天已经不能预约,明天任何小时都可以预约
            if (!hoursArr.length) {
                for (var h = 0; h < 24; h++) {
                    hoursArr.push(h);
                    initHourArr.push(h);
                }
            }

            for (
                var j = Math.ceil(currentMinutes / dism) * dism + pre_min;
                j < 60;
                j += dism
            ) {
                minutesArr.push(j);
                initMinuteArr.push(j);
            }

            //如果分钟没有满足条件的,说明现在已经30分以后,小时会自动加1
            if (!minutesArr.length) {
                for (
                    var k = Math.ceil((currentMinutes + pre_min - 60) / dism) * dism;
                    k < 60;
                    k += dism
                ) {
                    minutesArr.push(k);
                    initMinuteArr.push(k);
                }
            }
        })();

        //初始化数据
        var initData = (function (f) {
            selectedDay = daysArr[0];
            selectedHour = initHour = initHourArr[0];
            selectedMinute = initMinute = initMinuteArr[0];
        })();

        var time = document.querySelectorAll(".time-list"),
            timeDay = time[0],
            timeHour = time[1],
            timeMinute = time[2];

        //初始化html结构
        var initHtml = (function (f) {
            var timeDayHtml = "",
                timeHourHtml = "",
                timeMinuteHtml = "";

            daysArr.forEach(function (ele) {
                timeDayHtml += '<li class="time-list-item">' + ele + "</li>";
            });

            hoursArr.forEach(function (ele) {
                timeHourHtml += '<li class="time-list-item">' + ele + "\u70B9</li>";
            });

            minutesArr.forEach(function (ele) {
                timeMinuteHtml += '<li class="time-list-item">' + ele + "\u5206</li>";
            });

            timeDay.innerHTML = timeDayHtml;
            timeHour.innerHTML = timeHourHtml;
            timeMinute.innerHTML = timeMinuteHtml;
        })();

        //修改选择器风格

        var datePicker = (function () {
            function datePicker(obj) {
                var initIndex =
                    arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
                var callback = arguments[2];

                _classCallCheck(this, datePicker);

                this.obj = obj;
                this.index = -initIndex;
                this.callback = callback;
                this.deg = 0; //初始化偏转的角度
                this.length = this.obj.children.length;
                this.distance = this.obj.children[0].offsetHeight;
                this.ready();
            }

            _createClass(
                datePicker,
                [
                    {
                        key: "ready",
                        value: function ready() {
                            //初始化运动距离
                            datePicker.setTranslate3d(this.obj, this.index * this.distance);
                            //初始化3D偏转角度
                            datePicker.setRotateX(this.obj.children, this.index);
                            this.bind(this.obj);
                        }
                    },
                    {
                        key: "bind",
                        value: function bind(selector) {
                            var _this = this;

                            var iStartPageY = 0,
                                step = 1,
                                //弹性系数
                                prevPoint = 0,
                                speed = 0,
                                //手指离开时候的瞬时速度,速度越大,最后停留的越远
                                timer = null,
                                length = this.length - 1;

                            var touchstart = function touchstart(e) {
                                e.preventDefault();
                                e.stopPropagation();
                                clearInterval(timer);
                                iStartPageY = e.changedTouches[0].clientY;
                                prevPoint = iStartPageY;
                            };
                            var touchmove = function touchmove(e) {
                                e.preventDefault();
                                e.stopPropagation();
                                var iDisY = e.changedTouches[0].pageY - iStartPageY;
                                speed = e.changedTouches[0].pageY - prevPoint;
                                prevPoint = e.changedTouches[0].pageY;
                                //已滑动在头部或尾部,但是用户还想往上或下滑,这是给一种越往上或下滑越难拖动的体验
                                if (
                                    (_this.index == 0 && iDisY > 0) ||
                                    (_this.index == -length && iDisY < 0)
                                ) {
                                    step = 1 - Math.abs(iDisY) / selector.clientWidth; //根据超出长度计算系数大小，超出的越到 系数越小
                                    step = Math.max(step, 0); //系数最小值为0
                                    iDisY = parseInt(iDisY * step);
                                }
                                datePicker.setTranslate3d(
                                    selector,
                                    _this.index * _this.distance + iDisY
                                );
                                datePicker.setRotateX(
                                    _this.obj.children,
                                    _this.index + iDisY / _this.distance
                                );
                            };
                            var touchend = function touchend(e) {
                                e.preventDefault();
                                e.stopPropagation();
                                var iDisX = e.changedTouches[0].pageY - iStartPageY;
                                //初速度很小的逻辑处理
                                var flag = false;
                                if (Math.abs(speed) <= 1) {
                                    flag = true;
                                }
                                timer = setInterval(function (f) {
                                    if (Math.abs(speed) <= 1) {
                                        clearInterval(timer);
                                        if (flag) {
                                            _this.index += Math.round(iDisX / _this.distance);
                                        }
                                        _this.index =
                                            _this.index > 0
                                                ? Math.min(_this.index, 0)
                                                : Math.max(_this.index, -length);
                                        _this.index =
                                            _this.index > 0
                                                ? 0
                                                : _this.index < -length
                                                ? -length
                                                : _this.index;
                                        selector.style.transitionDuration = "400ms";
                                        selector.addEventListener("webkitTransitionEnd", function (f) {
                                            //touchend事件触发后会有一个动画，触发完成后立即清除transition
                                            selector.style.transitionDuration = "0ms";
                                        });
                                        Array.from(selector.children).forEach(function (ele) {
                                            ele.style.transitionDuration = "200ms";
                                            ele.addEventListener("webkitTransitionEnd", function (f) {
                                                ele.style.transitionDuration = "0ms";
                                            });
                                        });
                                        datePicker.setTranslate3d(
                                            selector,
                                            _this.index * _this.distance
                                        );
                                        datePicker.setRotateX(_this.obj.children, _this.index);
                                        _this.callback && _this.callback(Math.abs(_this.index));
                                    } else {
                                        speed *= 0.2;
                                        iDisX += speed;
                                        _this.index += Math.round(iDisX / _this.distance);
                                    }
                                }, 13);
                            };
                            selector.addEventListener("touchstart", touchstart, false);
                            selector.addEventListener("touchmove", touchmove, false);
                            selector.addEventListener("touchend", touchend, false);
                        }
                    }
                ],
                [
                    {
                        key: "setTranslate3d",
                        value: function setTranslate3d(obj, dis) {
                            obj.style.transform = "translate3d(0," + dis + "px,0)";
                        }
                    },
                    {
                        key: "setRotateX",
                        value: function setRotateX(obj, index) {
                            var deg =
                                arguments.length > 2 && arguments[2] !== undefined
                                    ? arguments[2]
                                    : 25;

                            //设置每个Li的偏转角度
                            Array.from(obj).forEach(function (ele, i) {
                                obj[i].style.transform = "rotateX(" + (i + index) * deg + "deg)";
                            });
                        }
                    }
                ]
            );

            return datePicker;
        })();

        new datePicker(timeDay, 0, function (indexDay) {
            var timeHourHtml = "",
                timeMinuteHtml = "";
            //没有逗号，这个selectedDay是全局变量。。。
            selectedDay = daysArr[indexDay];
            //今天
            if (indexDay == 0) {
                isToday = true;
                //用户选择今天,但是此时的小时已不满足要求,小于当前时间,需要重置初始化小时选项
                hoursArr = initHourArr;
                hoursArr.forEach(function (ele) {
                    timeHourHtml += '<li class="time-list-item">' + ele + "\u70B9</li>";
                });
                timeHour.innerHTML = timeHourHtml;
                var hindex = selectedHour < initHour ? 0 : hoursArr.indexOf(selectedHour);
                //重置当前选择的时间,从明天滑回选择今天需要重置selectedHour
                selectedHour = hoursArr[hindex];
                new datePicker(timeHour, hindex, function (indexHour) {
                    selectedHour = hoursArr[indexHour];
                });
                //用户选择今天,但是此时的分钟已不满足要求,小于当前时间,需要重置初始化分钟选项
                if (hindex === 0) {
                    minutesArr = initMinuteArr;
                    minutesArr.forEach(function (ele) {
                        timeMinuteHtml += '<li class="time-list-item">' + ele + "\u5206</li>";
                    });
                    timeMinute.innerHTML = timeMinuteHtml;
                    var mindex =
                        selectedMinute < initMinute ? 0 : minutesArr.indexOf(selectedMinute);
                    //重置当前选择的时间,从明天滑回选择今天需要重置selectedMinute
                    selectedMinute = minutesArr[mindex];
                    new datePicker(timeMinute, mindex, function (indexMinute) {
                        selectedMinute = minutesArr[indexMinute];
                    });
                }
                //明天或者后天
            } else {
                //天数选择影响小时
                isToday = false;
                hoursArr = [];
                for (var h = 0; h < 24; h++) {
                    hoursArr.push(h);
                }
                var _hindex = hoursArr.indexOf(selectedHour);
                hoursArr.forEach(function (ele) {
                    timeHourHtml += '<li class="time-list-item">' + ele + "\u70B9</li>";
                });
                timeHour.innerHTML = timeHourHtml;

                new datePicker(timeHour, _hindex, function (indexHour) {
                    selectedHour = hoursArr[indexHour];
                });
                //天数选择影响分钟
                minutesArr = [];
                for (var m = 0; m < 60; m += dism) {
                    minutesArr.push(m);
                }
                var _mindex = minutesArr.indexOf(selectedMinute);
                timeMinuteHtml = "";
                minutesArr.forEach(function (ele) {
                    timeMinuteHtml += '<li class="time-list-item">' + ele + "\u5206</li>";
                });
                timeMinute.innerHTML = timeMinuteHtml;
                new datePicker(timeMinute, _mindex, function (indexMinute) {
                    selectedMinute = minutesArr[indexMinute];
                });
            }
        });

        new datePicker(timeHour, 0, function (indexHour) {
            var timeMinuteHtml = "";
            selectedHour = hoursArr[indexHour];
            //滑到头部,这是要处理分钟是否小于当前时间
            if (indexHour == 0 && isToday) {
                minutesArr = initMinuteArr;
                minutesArr.forEach(function (ele) {
                    timeMinuteHtml += '<li class="time-list-item">' + ele + "\u5206</li>";
                });
                timeMinute.innerHTML = timeMinuteHtml;
                var mindex =
                    selectedMinute < initMinute ? 0 : minutesArr.indexOf(selectedMinute);
                //重置当前选择的时间,从明天滑回选择今天需要重置selectedMinute
                selectedMinute = minutesArr[mindex];
                new datePicker(timeMinute, mindex, function (indexMinute) {
                    selectedMinute = minutesArr[indexMinute];
                });
            } else {
                minutesArr = [];
                for (var m = 0; m < 60; m += dism) {
                    minutesArr.push(m);
                }
                var _mindex2 = minutesArr.indexOf(selectedMinute);
                minutesArr.forEach(function (ele) {
                    timeMinuteHtml += '<li class="time-list-item">' + ele + "\u5206</li>";
                });
                timeMinute.innerHTML = timeMinuteHtml;
                new datePicker(timeMinute, _mindex2, function (indexMinute) {
                    selectedMinute = minutesArr[indexMinute];
                });
            }
        });

        new datePicker(timeMinute, 0, function (indexMinute) {
            selectedMinute = minutesArr[indexMinute];
        });

        //获得最后选择的时间
        var sureTime = function sureTime(e) {
            e.preventDefault();
            e.stopPropagation();

            var minute = selectedMinute < 10 ? "0" + selectedMinute : selectedMinute,
                hour = selectedHour < 10 ? "0" + selectedHour : selectedHour,
                day =
                    parseInt(selectedDay.split("月")[1]) < 10
                        ? "0" + parseInt(selectedDay.split("月")[1])
                        : parseInt(selectedDay.split("月")[1]),
                month =
                    parseInt(selectedDay.split("月")[0].slice(-1)) < 10
                        ? "0" + parseInt(selectedDay.split("月")[0].slice(-1))
                        : parseInt(selectedDay.split("月")[0].slice(-1)),
                year = month == 1 && day < app ? currentYear + 1 : currentYear;
            //IOS版本浏览器不兼容new Date('2017-04-11')这种格式化，故用new Date('2017/04/11')
            var timeStamp = new Date(
                year + "/" + month + "/" + day + " " + hour + ":" + minute
                ).getTime(),
                timeStr = selectedDay + " " + hour + "\u70B9" + minute + "\u5206";

            sessionStorage.setItem("timeStamp", timeStamp);
            sessionStorage.setItem("timeStr", timeStr);
            var id = $(".time-controller").attr("attrId");
            $("#" + id).val(year + "-" + month + "-" + day + " " + hour + ":" + minute);
            document.querySelector(".time-controller").style.display = "none";
        };

        //显示隐藏
        var toggle = function toggle(e) {
            e.preventDefault();
            e.stopPropagation();
            document.querySelector(".time-controller").style.display = "none";
        };
        document.querySelector(".sure").addEventListener("touchend", sureTime, false);
        document.querySelector(".cancel").addEventListener("touchend", toggle, false);
    }

    datePicker({
        appointDays: 7, //默认可以预约未来7天
        preTime: 10, //默认只能预约10分钟之后,如果两个小时就填120
        disMinute: 10 //分钟的间隔，默认一分钟
    });
    $(".time-controller").css("display", "none");
    $(document).on("click", ".timeBox input", function () {
        $(".time-controller").attr("attrId", $(this).attr("id"));
        $(".time-controller").css("display", "block");
    });

</script>
</body>